<script type="text/javascript">jQuery.noConflict()</script>

<script type="text/javascript" language="javascript" src="<?php echo base_url() ?>media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="<?php echo base_url() ?>media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
        $('#example').dataTable();
    } );

</script>

<link media="screen" rel="stylesheet" href="<?php echo base_url(); ?>css/colorbox.css" />
<!--<script src="<?php echo base_url(); ?>jscripts/jquery-latest.min.js" type="text/javascript"></script>-->
<script src="<?php echo base_url(); ?>jscripts/jquery.colorbox-min.js" type="text/javascript"></script>

<!--the end of popup-->
<script type="text/javascript">
    $(function()
    {
        $('#link_content').colorbox({opacity:0.3});

    });
</script>
<!--this is the end of stylesheet-->
<!--end search -->

<style type="text/css" title="currentStyle">
    @import "<?php echo base_url() ?>media/css/demo_page.css";
    @import "<?php echo base_url() ?>media/css/demo_table.css";
</style>
<div style="float: left; border: 0px #ccc solid;"><?php echo anchor('sale_management/manager', img('images/user_images/cancel.png'),array('title'=>'Back')); ?></div>
<div style="margin: 0 auto;width: 100%;height: auto;border: 0px #ccc solid;text-align: center;font-size: 20px;color:#5C9416;">Sale Card Management</div><br/>
<div class="Tcontrol" style="margin: 0 auto; float: right;width:70px;height: auto;border: 1px #ccc solid;text-align: center;font-size: 20px;color:#006600;">
    <center><?php echo anchor('sale_management/add_card', img('images/icon-32-new.png'), array('id' => 'link_content','title'=>'Sale New Card')); ?><br />
        <span style="font-size: 9px;">Add New</span></center>
</div>
<div class="task1" style="float: left; width: 100%;height: auto;border: 0px #ccc solid;padding: 5px;">
    <?php
        if ($this->session->userdata('addcategory_ms')) {
            echo $this->session->userdata('addcategory_ms');
            echo $this->session->unset_userdata('addcategory_ms');
        } else if ($this->session->userdata('sucessadd')) {
            echo $this->session->userdata('sucessadd');
            echo $this->session->unset_userdata('sucessadd');
        }
        ?>
        <?php
        if ($this->session->userdata('add_card_ms')) {
            echo $this->session->userdata('add_card_ms');
            $this->session->unset_userdata('add_card_ms');
        } else if ($this->session->userdata('ms_card')) {
            echo $this->session->userdata('ms_card');
            $this->session->unset_userdata('ms_card');
        } else if ($this->session->userdata('del_salemanagment')) {
            echo $this->session->userdata('del_salemanagment');
            $this->session->unset_userdata('del_salemanagment');
        }
    ?>
    <div class="full_width big"></div>
    <div id="demo">
        <table cellpadding="0" cellspacing="0" border="0" class="mytable" id="example" width="100%">
            <thead>
                <tr style="background-color:#5C9416 ;color:#FFF;border:1px;text-align: center;font-weight: lighter;">
                    <?php
                    echo '<th>N&ordm;</th>';
                    echo '<th>Date</th>';
                    echo '<th>Customer Name</th>';
                    echo '<th>Card Name</th>';
                    echo '<th>Unit Price</th>';
                    echo '<th>Quantity</th>';
                    echo '<th>Payment</th>';
                    echo '<th>Credit</th>';
                    echo '<th>Seller</th>';
                    echo '<th>Action</th>';
                    ?>
                </tr>
            </thead>
            <tbody>
                <?php
                if ($values->num_rows() > 0) {
                    $j = 1;
                    foreach ($values->result() as $rows) {
                        echo '<tr style="text-align:center;font-weight: lighter;">';
                        echo '<td>' . $j . '</td>';
                        echo '<td>' . $rows->sal_date . '</td>';
                        echo '<td>' . $rows->stu_name . '</td>';
                        echo '<td>' . $rows->car_name . '</td>';
                        echo '<td>$' . $rows->sal_price . '</td>';
                        echo '<td>' . $rows->sal_quantity . '</td>';
                        echo '<td>$' . $rows->sal_payment . '</td>';

                        echo '<td>$' . (($rows->sal_price * $rows->sal_quantity) - ($rows->sal_payment)) . '</td>';
                        echo '<td>' . $rows->use_username . '</td>';
                        $admin = $this->session->userdata('user_type');
                        if ($admin == 1) {
                            echo '<td>' . anchor('sale_management/delet_card/' . $rows->sal_id, img(array('src' => 'images/web_images/icon-16-delete2.png', 'alt' => 'Delete', 'title' => 'Delete')), 'title=Delete onclick="return confirm(\'Are you sure you want to delete?\')"') . '|', anchor('sale_management/edit_salecard/' . $rows->sal_id, img(array('src' => 'images/web_images/icon-16-edit2.png', 'alt' => 'Edit', 'title' => 'Edit'))) . '|', anchor('sale_management/view_card/' . $rows->sal_id, img(array('src' => 'images/web_images/view1.png', 'alt' => 'Detail', 'title' => 'Detail'))) . '</td>';
                            echo '</tr>';
                        } else {
                            echo '<td>', anchor('sale_management/edit_salecard/' . $rows->sal_id, img(array('src' => 'images/web_images/icon-16-edit2.png', 'alt' => 'Edit', 'title' => 'Edit'))) . '|', anchor('sale_management/view_card/' . $rows->sal_id, img(array('src' => 'images/web_images/view1.png', 'alt' => 'Detail', 'title' => 'Detail'))) . '</td>';
                        }
                        $j++;
                    }
                } else {
                    echo '<tr >';
                    echo '<td colspan="10"><p style="color:red;text-align:center;">No card are found!</td></p>';
                    echo '</tr>';
                }
                ?>
            </tbody>
        </table>
    </div>
    <div class="spacer"></div>
    <h1>&nbsp;</h1>
    <h1>&nbsp;</h1>
</div>

